package com.diver.flinkdemo.mapper.mysqlMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.diver.flinkdemo.entity.xxt.SecurityArea;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * @author guofy
 * @create 18/8/17 下午3:52
 **/
@Mapper
//@Component
public interface SecurityAreaMapper extends BaseMapper<SecurityArea> {

    @Select("select * from security_area where student_card_id = #{studentCardId} and type !='others' and delete_flag=0")
    List<SecurityArea> queryHomeAndSchool(String studentCardId);

    @Delete("delete from security_area where student_card_id=#{studentCardId}")
    int delByStudentCardId(String studentCardId);

    /**
     * 平台通知修改学校安全区域
     *
     * @param params {address，longitude，latitude，radius，updateTime，studentCardIds}
     * @return
     */
    int batchUpdateSchoolArea(Map<String, Object> params);

    /**
     * 根据studentCardId、areaTypes 批量删除安全区域
     *
     * @param studentCardIds
     * @return
     */
    int batchDelArea(@Param("studentCardIds") List<String> studentCardIds, @Param("areaTypes") List<String> areaTypes);

    int batchInsert(@Param("areas") List<SecurityArea> areas);

    @Update("update security_area set wifi =#{wifi} where id =#{areaId}")
    int updateWifi(@Param("wifi") String wifi , @Param("areaId") String areaId);
}
